Option Compare Database
Option Explicit
Private rst1 As ADODB.Recordset

Private Sub Form_Load()
'Dim rst1 As ADODB.Recordset

'Instantiate a recordset and open it on a subset of the 
'columns and rows in the Outlook Inbox
Set rst1 = New ADODB.Recordset
rst1.CursorLocation = adUseClient
rst1.Open "SELECT [From], Subject, Received, Contents " & _
     "FROM Inbox IN 'C:\Windows\Temp\;'" & _
     "[Outlook 9.0;MAPILEVEL=Personal Folders|;]" & _
     "WHERE InStr(Contents, 'Book') > 0;", _
     CurrentProject.Connection, , , adCmdText

'Open Outlook Contents Search and assign rst1 to it
DoCmd.OpenForm "Outlook Contents Search"
Set Application.Forms("Outlook Contents Search").Recordset = rst1
     
'Clean up before exiting
rst1.Close
Set rst1 = Nothing
     
End Sub
